import React from 'react';
import { Switch, Route, BrowserRouter as Router } from 'react-router-dom';
import {routeArray} from './common/route/routeConfig';
import { ContextStore, InitState } from './common/model/store';
import { reducer } from './common/model/reducer';
// import Tabbar from './common/ui/TabBar'
function App() {
  const [state, dispatch] = React.useReducer(reducer, InitState);
  return (
    <div className="App">
      <ContextStore.Provider
        value={{
          ...state,
          dispatch,
        }}
      >
       <Router>
          <Switch>
            {routeArray.map(route => (
              <Route exact path={route.path} key={route.path} render={route.component} />
            ))}
          </Switch>
          {/* <Tabbar/> */}
        </Router>
      </ContextStore.Provider>
    </div>
  );
}

export default App;
